#include <stdio.h>
int main()
{
	int t1,t2;
	scanf("%d %d",&t1,&t2);
	int a=t1/100*60+t1%100;
	int b=a+t2;
	printf("%d\n",b/60*100+b%60);
}
